package com.wcq.studentbackend.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal; // 或者 Integer/Double，取决于成绩精度
import java.time.LocalDateTime;

@Data
@EqualsAndHashCode(callSuper = false)
@TableName("grades") // 假设数据库表名为 grades
public class Grade implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @TableField("student_id")
    private Long studentId; // 关联学生表的外键

    @TableField("exam_id")
    private Long examId;    // 关联考试表的外键

    // 使用 BigDecimal 存储分数以保证精度，或者根据实际需求选择 Integer/Double
    // 如果用 Integer，假设分数都是整数
    private Integer score;

    @TableField("create_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    private LocalDateTime createTime;

    @TableField("update_time")
    @DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    @JsonFormat(pattern = "yyyy-MM-dd'T'HH:mm")
    private LocalDateTime updateTime;
} 